package com.bwie.controller;
import com.bwie.pojo.Type;
import com.bwie.service.Impl.TypeServiceImpl;
import com.bwie.service.TypeService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
* (t_type)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/user/type")
public class TypeController {
/**
* 服务对象
*/
    @Autowired
    private TypeService typeService;

    @PostMapping("/test")
    public R test(){
        return R.OK("test");
    }

    /**
     * 房型列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getTypeList")
    public R getTypeList(
            @RequestBody PageInfoVo pageInfoVo
            ){
        return typeService.getTypeList(pageInfoVo);
    }

    /**
     * 添加房型
     * @param type
     * @return
     */
    @PostMapping("/addType")
    public R addType(
        @RequestBody @Validated Type type
    ){
        return typeService.addType(type);
    }

    /**
     * 修改房型
     * @return
     */
    @PostMapping("/updateType")
    public R updateType(
        @RequestBody Type type
    ){
        return typeService.updateType(type);
    }
}
